package com.yurendao.shop.pager.domain;

import java.util.List;

/**
 * Created by kong on 16/2/15.
 */
public class Page<T> {

    private List<T> records;
    private int pageOffset;
    private int totalRecords;
    private static int limit = 20;

    public Page(List<T> records,int pageOffset,int totalRecords){
        this.records = records;
        this.pageOffset = pageOffset;
        this.totalRecords = totalRecords/limit+1;
    }

    public List<T> getRecords() {
        return records;
    }

    public void setRecords(List<T> records) {
        this.records = records;
    }

    public int getPageOffset() {
        return pageOffset;
    }

    public void setPageOffset(int pageOffset) {
        this.pageOffset = pageOffset;
    }

    public int getTotalRecords() {
        return totalRecords;
    }

    public void setTotalRecords(int totalRecords) {
        this.totalRecords = totalRecords;
    }

    public static int getPc(int pageOffset){
        return (pageOffset-1)*limit;
    }

    public static int getPs(int pageOffset){
        return (pageOffset)*limit;
    }
}
